<?php 
namespace app\admin\controller;

use think\Controller;
use think\facade\Validate;

/**
 * 系统管理
 */
class System extends Controller
{
	/*系统管理页面*/
	public function index()
	{
		if(request()->isAjax()){
			$data = input();
			if(!$data['id']){
				unset($data['id']);
				
				$res = model('System')->save($data);
			}else{
				$res = model('System')->save($data,['id'=>$data['id']]);
			}
			
			if($res){
				$this->result('',1,'操作成功','json');
			}else{
				$this->result('',0,'操作失败','json');
			}
		}

		$data = model('System')::get(1);

		$this->assign('data',$data);

		return view();
	}

}

 ?>